﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JqueryNet.FormControl.FormHtmlControl
{
    public class JHtmlInputFile : JHtmlInputControl //JHtmlControl
    {
        private System.Web.UI.HtmlControls.HtmlInputFile htmlInputFile;

        public JHtmlInputFile(System.Web.UI.HtmlControls.HtmlInputFile htmlInputFile):base(htmlInputFile)
        {
            // TODO: Complete member initialization
            this.htmlInputFile = htmlInputFile;            
        }

        public override void Attr(string key)
        {                        
            switch (key.ToLower())
            {
                case "accept":
                    Value = htmlInputFile.Accept;
                    return;
                case "maxlength":
                    Value = htmlInputFile.MaxLength;return;
                case "size":
                    Value = htmlInputFile.Size;
                    return; 
                default: base.Attr(key);
                    return;
            }           
        }

        public override void Attr(string key,string value)
        {
            int b;
            int.TryParse(value, out b);
            switch (key.ToLower())
            {             
                case "accept":
                    htmlInputFile.Accept = value;
                    return;
                case "maxlength":
                 htmlInputFile.MaxLength=b; return;
                case "size":
                    htmlInputFile.Size = b;
                    return;                                   
                default: base.Attr(key);
                    return;
            }
        }        
    }
}
